--[[
LuCI - Lua Configuration Interface

Copyright 2013 Steven Barth <steven@midlink.org>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

	http://www.apache.org/licenses/LICENSE-2.0

]]--
local fs = require "nixio.fs"
--local authmode = 1
local authmode = luci.sys.exec("cat /proc/authmode")
local flashid = luci.sys.exec("cat /proc/flashid")

local m, s, p, o

m = Map("system")

if authmode == "0" then
s = m:section(TypedSection, "system", translate("授权ID"), flashid)
s.addremove = false
s.anonymous = true               
o = s:option(Value, "authkey", translate("授权码"))
else
s = m:section(TypedSection, "system", translate("已授权"), flashid)
s.addremove = false
s.anonymous = true   
o = s:option(Value, "authkey", translate("授权码"))
end
local apply = luci.http.formvalue("cbi.apply")
if apply then
	io.popen("/etc/init.d/authkey start")
end
                                                                                        
return m                   
          
